//Copyright (C) 2012 Chirila Alexandru
//This file is part of Robo-GoldMiner
//
//Robo-GoldMiner is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//Robo-GoldMiner is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with Robo-GoldMiner.  If not, see <http://www.gnu.org/licenses/>.


package gold;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

/**
 * This command tries to turn the player clockwise.
 * Sintax: turnCW <br />
 */
public class CommandTurnCW implements UndoCommand, Serializable {

	private static final long serialVersionUID = 4644986116753493994L;
	private Maze m;
	
	public CommandTurnCW(Maze m){
		this.m = m;
	}
	
	@Override
	public boolean execute() {
		return m.turnCW();
	}

	@Override
	public void undo() {
		m.turnCCW();
		
	}

	@Override
	public UndoCommand copy() {
		return new CommandTurnCW(m);
	}
	

	private void writeObject(ObjectOutputStream stream) throws IOException {
		stream.defaultWriteObject();
	}

	private void readObject(ObjectInputStream stream) throws IOException,
			ClassNotFoundException {
		stream.defaultReadObject();
	}

}
